package com.yq.backend.controller;

import com.yq.backend.dto.CardProductsDto;
import com.yq.backend.pojo.CardGame;
import com.yq.backend.pojo.CardProduct;
import com.yq.backend.pojo.Result;
import com.yq.backend.service.CardProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @descriptions: 活动管理
 * @author: yunqiang
 * @date: 2022/5/3 11:27
 */
@Api(tags = {"奖券管理：奖品管理控制类"})
@RestController
@RequestMapping("/api/v1/cardProduct")
public class CardProductController {

    @Autowired
    private CardProductService cardProductService;


    @ApiOperation(value = "奖品列表")
    @PostMapping("/getCardProducts")
    public Result getCardProducts(@RequestBody CardProductsDto cardProductsDto) {
        return this.cardProductService.getCardProducts(cardProductsDto);
    }

    @ApiOperation(value = "添加奖品")
    @PostMapping("/addCardProduct")
    public Result addCardProduct(@RequestBody CardProduct cardProduct) {
        return this.cardProductService.addCardProduct(cardProduct);
    }

    @ApiOperation(value = "修改奖品")
    @PostMapping("/upCardProduct")
    public Result upCardProduct(@RequestBody CardProduct cardProduct) {
        return this.cardProductService.upCardProduct(cardProduct);
    }

    @ApiOperation(value = "删除奖品")
    @GetMapping("/delCardProduct/{id}")
    public Result delCardProduct(@PathVariable Integer id) {
        return this.cardProductService.delCardProduct(id);
    }

    @ApiOperation(value = "根据id查询奖品")
    @GetMapping("/cardProduct/{id}")
    public Result getCardProductId(@PathVariable Integer id) {
        return this.cardProductService.cardProduct(id);
    }
}
